package ws.jdbc.concurrent.driver.sqlserver.tds;

import java.nio.ByteBuffer;

/**
 * Handles the {@code DONEINPROC} token reading process.
 *
 * <p>
 * This token is used to indicate the completion status of commands within a
 * stored procedure.
 * </p>
 *
 * <p>
 * A DONEINPROC token is sent for each executed statement within a stored procedure.
 * </p>
 *
 * <p>
 * A DONEINPROC token MUST be followed by another DONEPROC token or a DONEINPROC token.
 * </p>
 * 
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
class DoneInProcTokenReader extends DoneTokenReader {

  /**
   * Create a new reader instance.
   *
   * @param stream data input stream to read the token from.
   */
  public DoneInProcTokenReader(final ByteBuffer stream) {
    super(stream);
  }

  /**
   * Token as a {@code String}.
   *
   * @return token fields as a {@code String}.
   */
  @Override
  public String toString() {
    return done2String("DoneInProcTokenReader", "DONE_MORE=" + isDoneMore()
            + ", DONE_ERROR=" + isDoneError()
            + ", DONE_COUNT=" + isDoneCount()
            + ", DONE_INXACT=" + isDoneInxact()
            + ", DONE_SVRERROR=" + isDoneSrvError());
  }
}
